 package server.life;

 import java.awt.Point;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import provider.MapleData;
 import provider.MapleDataDirectoryEntry;
 import provider.MapleDataEntry;
 import provider.MapleDataProvider;
 import provider.MapleDataProviderFactory;
 import provider.MapleDataTool;

 public class MobSkillFactory
 {
/*  20 */   private static final Logger log = LogManager.getLogger(MobSkillFactory.class.getName());
/*  21 */   private static final Map<String, MobSkill> allMobSkills = new HashMap<>();

   private MobSkillFactory() {
/*  24 */     initialize();
   }

































































   public static void initialize() {
/*  92 */     MapleDataProvider dataSource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
/*  93 */     MapleDataDirectoryEntry e = (MapleDataDirectoryEntry)dataSource.getRoot().getEntry("MobSkill");
/*  94 */     for (MapleDataEntry d : e.getFiles()) {
/*  95 */       MapleData skillRoot = dataSource.getData("MobSkill/" + d.getName());
/*  96 */       for (MapleData levelData : skillRoot.getChildByPath("level")) {
/*  97 */         int skillId = Integer.parseInt(d.getName().replaceAll(".img", ""));
/*  98 */         int level = Integer.parseInt(levelData.getName());
/*  99 */         List<Integer> toSummon = new ArrayList<>();
/* 100 */         for (int i = 0; i <= 200 && 
/* 101 */           levelData.getChildByPath(String.valueOf(i)) != null; i++)
         {

/* 104 */           toSummon.add(Integer.valueOf(MapleDataTool.getInt(levelData.getChildByPath(String.valueOf(i)), 0)));
         }
/* 106 */         MapleData ltdata = levelData.getChildByPath("lt");
/* 107 */         Point lt = null;
/* 108 */         if (ltdata != null) {
/* 109 */           lt = (Point)ltdata.getData();
         }
/* 111 */         MapleData rbdata = levelData.getChildByPath("rb");
/* 112 */         Point rb = null;
/* 113 */         if (rbdata != null) {
/* 114 */           rb = (Point)rbdata.getData();
         }
/* 116 */         MobSkill ret = new MobSkill(skillId, level);
/* 117 */         ret.addSummons(toSummon);
/* 118 */         ret.setCoolTime((MapleDataTool.getInt("interval", levelData, 0) * 1000));
/* 119 */         ret.setDuration((MapleDataTool.getInt("time", levelData, 0) * 1000));
/* 120 */         ret.setHp(MapleDataTool.getInt("hp", levelData, 100));
/* 121 */         ret.setMpCon(MapleDataTool.getInt("mpCon", levelData, 0));
/* 122 */         ret.setSpawnEffect(MapleDataTool.getInt("summonEffect", levelData, 0));
/* 123 */         ret.setX(MapleDataTool.getInt("x", levelData, 1));
/* 124 */         ret.setY(MapleDataTool.getInt("y", levelData, 1));
/* 125 */         ret.setProp(MapleDataTool.getInt("prop", levelData, 100) / 100.0F);
/* 126 */         ret.setLimit((short)MapleDataTool.getInt("limit", levelData, 0));
/* 127 */         ret.setOnce((MapleDataTool.getInt("summonOnce", levelData, 0) > 0));
/* 128 */         ret.setLtRb(lt, rb);
/* 129 */         ret.setAreaSequenceDelay(MapleDataTool.getInt("areaSequenceDelay", levelData, 0));
/* 130 */         ret.setSkillAfter(MapleDataTool.getInt("skillAfter", levelData, 0));
/* 131 */         ret.setForce(MapleDataTool.getInt("force", levelData, 0));
/* 132 */         ret.setForcex(MapleDataTool.getInt("forcex", levelData, 0));
/* 133 */         allMobSkills.put(skillId + ":" + level, ret);
       }
     }
/* 136 */     log.info("共加载 " + allMobSkills.size() + " 个怪物技能信息...");
   }






   public static MobSkill getMobSkill(int skillId, int level) {
/* 145 */     return allMobSkills.get(skillId + ":" + level);
   }
 }


/* Location:              C:\PGX\Server.jar!\server\life\MobSkillFactory.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */